package com.tul.exercise.base.operator.egs;

import org.junit.jupiter.api.Test;

import static com.tul.exercise.base.utils.Print.print;

/**
 * @Description 《java编程思想》第3章 示例7：
 *
 *  字面量
 *
 **/
public class Literals {

    @Test
    public void test() {
        int i1 = 0x2f;
        print("i1: " + Integer.toBinaryString(i1));

        int i2 = 0X2f;
        print("i2: " + Integer.toBinaryString(i2));

        int i3 = 0177;
        print("i3: " + Integer.toBinaryString(i3));

        char c = 0xffff;
        print("c: " + Integer.toBinaryString(c));


        byte b = 0x7f;
        print("b: " + Integer.toBinaryString(b));

        short s = 0x7fff;
        print("s: " + Integer.toBinaryString(s));

        long n1 = 200l;
        long n2 = 200L;
        long n3 = 200;
        print("n1=" + n1 + ",n2=" + n2 + ",n3=" +  n3);

        float f1 = 1;
        float f2 = 1F;
        float f3 = 1f;
        print("f1=" + f1 + ",f2=" + f2 + ",f3=" +  f3);

        double d1 = 1d;
        double d2 = 1D;
        print("d1=" + d1 + ",d2=" + d2);

    }
}
